.class Lcom/android/inputmethod/latin/GoogleVoiceManager$5;
.super Ljava/lang/Object;
.source "GoogleVoiceManager.java"

# interfaces
.implements Landroid/speech/RecognitionListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/inputmethod/latin/GoogleVoiceManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;


# direct methods
.method constructor <init>(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V
    .locals 0
    .parameter

    .prologue
    .line 581
    iput-object p1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onBeginningOfSpeech()V
    .locals 2

    .prologue
    .line 478
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    const/4 v1, 0x0

    iput-boolean v1, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechEnded:Z

    .line 479
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$800(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Ljava/io/ByteArrayOutputStream;

    move-result-object v1

    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->size()I

    move-result v1

    invoke-static {v0, v1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$702(Lcom/android/inputmethod/latin/GoogleVoiceManager;I)I

    .line 480
    return-void
.end method

.method public onBufferReceived([B)V
    .locals 3
    .parameter "buf"

    .prologue
    .line 512
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$800(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Ljava/io/ByteArrayOutputStream;

    move-result-object v0

    const/4 v1, 0x0

    array-length v2, p1

    invoke-virtual {v0, p1, v1, v2}, Ljava/io/ByteArrayOutputStream;->write([BII)V

    .line 513
    return-void
.end method

.method public onEndOfSpeech()V
    .locals 2

    .prologue
    .line 487
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    const/4 v1, 0x1

    iput-boolean v1, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mSpeechEnded:Z

    .line 488
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v0, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$100(Lcom/android/inputmethod/latin/GoogleVoiceManager;)Ljava/lang/Runnable;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 490
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    const/4 v1, 0x3

    iput v1, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mCurrentStatus:I

    .line 492
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v0, v0, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/android/inputmethod/latin/GoogleVoiceManager$5$1;

    invoke-direct {v1, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$5$1;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager$5;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 497
    return-void
.end method

.method public onError(I)V
    .locals 1
    .parameter "error"

    .prologue
    .line 516
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-virtual {v0, p1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->onError(I)V

    .line 517
    return-void
.end method

.method public onEvent(ILandroid/os/Bundle;)V
    .locals 0
    .parameter "eventType"
    .parameter "params"

    .prologue
    .line 579
    return-void
.end method

.method public onPartialResults(Landroid/os/Bundle;)V
    .locals 0
    .parameter "partialResults"

    .prologue
    .line 586
    return-void
.end method

.method public onReadyForSpeech(Landroid/os/Bundle;)V
    .locals 1
    .parameter "bundle"

    .prologue
    .line 471
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$600(Lcom/android/inputmethod/latin/GoogleVoiceManager;)V

    .line 472
    return-void
.end method

.method public onResults(Landroid/os/Bundle;)V
    .locals 13
    .parameter "resultsBundle"

    .prologue
    const/4 v12, 0x5

    const/4 v11, 0x0

    .line 521
    iget-object v9, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-boolean v9, v9, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mIsVoiceKeyboardShown:Z

    if-eqz v9, :cond_7

    .line 523
    const-string v9, "results_recognition"

    invoke-virtual {p1, v9}, Landroid/os/Bundle;->getStringArrayList(Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object v7

    .line 531
    .local v7, results:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    new-instance v2, Ljava/util/HashMap;

    invoke-direct {v2}, Ljava/util/HashMap;-><init>()V

    .line 533
    .local v2, alternatives:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/CharSequence;>;>;"
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v9

    const/4 v10, 0x2

    if-lt v9, v10, :cond_4

    .line 534
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v9

    new-array v8, v9, [[Ljava/lang/String;

    .line 535
    .local v8, words:[[Ljava/lang/String;
    const/4 v3, 0x0

    .local v3, i:I
    :goto_0
    array-length v9, v8

    if-ge v3, v9, :cond_0

    .line 536
    invoke-interface {v7, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v9

    check-cast v9, Ljava/lang/String;

    const-string v10, " "

    invoke-virtual {v9, v10}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v9

    aput-object v9, v8, v3

    .line 535
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 539
    :cond_0
    const/4 v4, 0x0

    .local v4, key:I
    :goto_1
    aget-object v9, v8, v11

    array-length v9, v9

    if-ge v4, v9, :cond_4

    .line 540
    aget-object v9, v8, v11

    aget-object v9, v9, v4

    new-instance v10, Ljava/util/ArrayList;

    invoke-direct {v10}, Ljava/util/ArrayList;-><init>()V

    invoke-interface {v2, v9, v10}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 541
    const/4 v0, 0x1

    .local v0, alt:I
    :goto_2
    array-length v9, v8

    if-ge v0, v9, :cond_3

    .line 542
    aget-object v9, v8, v0

    array-length v9, v9

    mul-int/2addr v9, v4

    aget-object v10, v8, v11

    array-length v10, v10

    div-int v5, v9, v10

    .line 543
    .local v5, keyBegin:I
    add-int/lit8 v9, v4, 0x1

    aget-object v10, v8, v0

    array-length v10, v10

    mul-int/2addr v9, v10

    aget-object v10, v8, v11

    array-length v10, v10

    div-int v6, v9, v10

    .line 545
    .local v6, keyEnd:I
    move v3, v5

    :goto_3
    aget-object v9, v8, v0

    array-length v9, v9

    invoke-static {v9, v6}, Ljava/lang/Math;->min(II)I

    move-result v9

    if-ge v3, v9, :cond_2

    .line 546
    aget-object v9, v8, v11

    aget-object v9, v9, v4

    invoke-interface {v2, v9}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/util/List;

    .line 547
    .local v1, altList:Ljava/util/List;,"Ljava/util/List<Ljava/lang/CharSequence;>;"
    aget-object v9, v8, v0

    aget-object v9, v9, v3

    invoke-interface {v1, v9}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v9

    if-nez v9, :cond_1

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v9

    const/4 v10, 0x6

    if-ge v9, v10, :cond_1

    .line 548
    aget-object v9, v8, v0

    aget-object v9, v9, v3

    invoke-interface {v1, v9}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 545
    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_3

    .line 541
    .end local v1           #altList:Ljava/util/List;,"Ljava/util/List<Ljava/lang/CharSequence;>;"
    :cond_2
    add-int/lit8 v0, v0, 0x1

    goto :goto_2

    .line 539
    .end local v5           #keyBegin:I
    .end local v6           #keyEnd:I
    :cond_3
    add-int/lit8 v4, v4, 0x1

    goto :goto_1

    .line 555
    .end local v0           #alt:I
    .end local v3           #i:I
    .end local v4           #key:I
    .end local v8           #words:[[Ljava/lang/String;
    :cond_4
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v9

    if-le v9, v12, :cond_5

    .line 556
    invoke-interface {v7, v11, v12}, Ljava/util/List;->subList(II)Ljava/util/List;

    move-result-object v7

    .line 559
    :cond_5
    iget-object v9, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v9, v9, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVIListener:Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;

    if-eqz v9, :cond_6

    .line 560
    iget-object v9, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v9, v9, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mVIListener:Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;

    invoke-interface {v9, v7, v2}, Lcom/android/inputmethod/latin/VoiceKeyboardManager$VoiceInputListener;->onVoiceResults(Ljava/util/List;Ljava/util/Map;)V

    .line 563
    :cond_6
    iget-object v9, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iget-object v9, v9, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mHandler:Landroid/os/Handler;

    new-instance v10, Lcom/android/inputmethod/latin/GoogleVoiceManager$5$2;

    invoke-direct {v10, p0}, Lcom/android/inputmethod/latin/GoogleVoiceManager$5$2;-><init>(Lcom/android/inputmethod/latin/GoogleVoiceManager$5;)V

    invoke-virtual {v9, v10}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 570
    .end local v2           #alternatives:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/CharSequence;>;>;"
    .end local v7           #results:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_7
    iget-object v9, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    iput v11, v9, Lcom/android/inputmethod/latin/GoogleVoiceManager;->mCurrentStatus:I

    .line 572
    return-void
.end method

.method public onRmsChanged(F)V
    .locals 2
    .parameter "rmsdB"

    .prologue
    .line 503
    iget-object v0, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v0}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$1000(Lcom/android/inputmethod/latin/GoogleVoiceManager;)[Ljava/lang/Byte;

    move-result-object v0

    monitor-enter v0

    .line 504
    :try_start_0
    iget-object v1, p0, Lcom/android/inputmethod/latin/GoogleVoiceManager$5;->this$0:Lcom/android/inputmethod/latin/GoogleVoiceManager;

    invoke-static {v1, p1}, Lcom/android/inputmethod/latin/GoogleVoiceManager;->access$1102(Lcom/android/inputmethod/latin/GoogleVoiceManager;F)F

    .line 505
    monitor-exit v0

    .line 506
    return-void

    .line 505
    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method
